﻿using DevExpress.XtraEditors.Controls;
using DevExpress.XtraEditors.Repository;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace QuanLyNhaHang.GUI
{
    public partial class ComponentMng : Form
    {
        public ComponentMng()
        {
            InitializeComponent();
        }

        private void ComponentMng_Load(object sender, EventArgs e)
        {
            loadTMP();

        }

        public void loadTMP()
        {
            DataTable dtCombo = new DataTable();
            dtCombo.Columns.Add(new DataColumn("Key"));
            //dtCombo.Columns.Add(new DataColumn("Value"));
            DataRow dr2 = dtCombo.NewRow();
            dr2.BeginEdit();
            dr2["Key"] = "KG";
            //dr
            dr2.EndEdit();
            dtCombo.Rows.Add(dr2);


            DataTable dt = new DataTable();
            dt.Columns.Add(new DataColumn("STT"));
            dt.Columns.Add(new DataColumn("TenTP"));
            dt.Columns.Add(new DataColumn("DVT"));
            dt.Columns.Add(new DataColumn("SL"));

            DataRow dr = dt.NewRow();
            dr.BeginEdit();
            dr["STT"] = "1";
            dr["TenTP"] = "Ca Chinh";
            dr["DVT"] = "KG";
            dr["SL"] = 0;
            dr.EndEdit();
            dt.Rows.Add(dr);

            gridControl1.DataSource = dt;

            RepositoryItemLookUpEdit myLookup = new RepositoryItemLookUpEdit();

            myLookup.DisplayMember = "Key";
            myLookup.ValueMember = "Key";

            myLookup.Columns.Add(new LookUpColumnInfo("Key", 0, "Chai"));
            myLookup.DataSource = dtCombo;

            gridView1.Columns["DVT"].ColumnEdit = myLookup;




            listViewTPhan.Clear(); listViewTPhan.Groups.Clear();
            listViewTPhan.ShowGroups = true; listViewTPhan.View = View.Tile;
            listViewTPhan.LargeImageList = imageList1;
            //f.listViewTable.LargeImageList = f.imageList1;

            listViewTPhan.Groups.Add(new ListViewGroup("Thành phần"));
            listViewTPhan.Groups.Add(new ListViewGroup("Khai vị"));
            listViewTPhan.Groups.Add(new ListViewGroup("Lẫu"));

            ListViewItem item = new ListViewItem("Tất cả thành phần");
            item.Group = listViewTPhan.Groups[0]; item.ImageIndex = 0;
            listViewTPhan.Items.Add(item);

            ListViewItem item2 = new ListViewItem("Các loại trái cây");
            item2.Group = listViewTPhan.Groups[1]; item2.ImageIndex = 0;
            listViewTPhan.Items.Add(item2);

            ListViewItem item3 = new ListViewItem("Các loại cá");
            item3.Group = listViewTPhan.Groups[2]; item3.ImageIndex = 0;
            listViewTPhan.Items.Add(item3);

            ListViewItem item4 = new ListViewItem("Các loại rau");
            item4.Group = listViewTPhan.Groups[2]; item4.ImageIndex = 0;
            listViewTPhan.Items.Add(item4);
        }
    }
}
